<?php
/**
 ***** 扶摇而上、抱守本真 ******
 * @author Dana
 * @Date 2021/6/23
 */

class Mysql
{
    private static $instance = null;

    public static function getInstance()
    {
        if(is_null(self::$instance)){
            self::$instance = (new static())->connection();
        }
        return self::$instance;
    }

    protected function connection(){
        $cn = mysqli_connect('127.0.0.1','test','123456','tpch_small');
        if(mysqli_error($cn)){
            return 'connection failed';
        }
        return $cn;
    }

    public function query($sql)
    {
        return mysqli_query(self::$instance,$sql);
    }





}